﻿using IntelligentAgriculture.Contracts.Dto.Output;
using IntelligentAgriculture.Contracts.Interface;
using IntelligentAgriculture.WebAPI.Application.Command.SheepAblactationCommand;
using MediatR;

namespace IntelligentAgriculture.WebAPI.Application.CommandHandler.SheepAblactationCommandHandler
{
    public class GetSheepAblactationCommandHandler : IRequestHandler<GetSheepAblactationCommand, Results<PageOutput<SheepAblactationOutput>>>
    {
        private readonly ISheepAblactationService _service;

        public GetSheepAblactationCommandHandler(ISheepAblactationService service)
        {
            _service = service;
        }
        public async Task<Results<PageOutput<SheepAblactationOutput>>> Handle(GetSheepAblactationCommand request, CancellationToken cancellationToken)
        {
            var list = await _service.GetSheepAblactation(request.Input);
            return Results<PageOutput<SheepAblactationOutput>>.DataResult(list);
        }
    }
}
